'''------------------------------------------------------------------------------------------------
 $ @Author: your name
 $ @Date: 2021-12-22 17:09:55
$ @LastEditTime: 2022-03-03 15:32:39
$ @LastEditors: your name
 $ @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 $ @FilePath: \YSQTrackerEvaluationToolKit_v1.0\test.py
--------------------------------------------------------------------------------------------------'''

from cProfile import label
import matplotlib.pyplot as plt
from loguru import logger
import random
import cv2
import os
import numpy as np
import glob

if __name__ == '__main__':
    # dir = r'F:\tracking_test_DataSet\My_OTB100'
    # outputDir = r'C:\Users\Administrator\Desktop\ji'
    # videosName = os.listdir(dir)

    # for name in videosName:
    #     try:
    #         anno = np.loadtxt(dir+'/'+name+'/groundtruth_rect.txt',delimiter=',')
    #     except:
    #         anno = np.loadtxt(dir+'/'+name+'/groundtruth_rect.txt')
    #     anno = np.array(anno,dtype=np.int)
    #     vedio_dir = dir + '/'+name
    #     seq_dir = os.path.expanduser(vedio_dir)
    #     os.path.join(seq_dir, 'img')
    #     img_files = sorted(glob.glob(os.path.join(seq_dir, 'img/') + '*.jpg'))

    #     if not os.path.exists(outputDir+'/'+name):
    #         os.mkdir(outputDir+'/'+name)

    #     for frame in range(len(img_files)):
    #         img = cv2.imread(img_files[frame])
    #         pt1 = (anno[frame][0],anno[frame][1])
    #         pt2 = (anno[frame][0]+anno[frame][2],anno[frame][1]+anno[frame][3])
    #         img = cv2.rectangle(img,pt1,pt2,(0,0,255),thickness = 2)
    #         cv2.imwrite(outputDir+'/'+name+'/%08d'%frame+'.jpg',img)


    #!----------------------------------------------------------------------
    x = np.linspace(1,20,20)
    y1 = x+1
    y2 = x+2
    plt.figure()
    plt.plot(x,y1,label='y1')
    plt.plot(x,y2,label='y2')

    handles,lables = plt.gca().get_legend_handles_labels()
    handles = [handles[1],handles[0]]
    labels = [lables[1],lables[0]]

    plt.legend(handles,labels)
    plt.show()
    d = {}
    t = [1.0,2,3,4,5]
    for i in t:
        d[i]=i
    t.sort(reverse=True)
    for i in t:
        print(d[i])
